import Vue from 'vue';
import Router from 'vue-router';

Vue.use(Router);

export default new Router({
    routes: [
        {
            path: '/',
            redirect: '/login'
        },
        {
            path: '/readme',
            component: resolve => require(['../components/common/Home.vue'], resolve),
            children:[
                {
                    path: '/',
                    component: resolve => require(['../components/user/Readme.vue'], resolve),
                    meta: {
            			requireAuth: true,  // 添加该字段，表示进入这个路由是需要登录的
      				}
                },
                //用户管理
                {
                    path: '/userindex',
                    component: resolve => require(['../components/user/Userindex.vue'], resolve),
                    meta: {
            			requireAuth: true,  // 添加该字段，表示进入这个路由是需要登录的
      				}
                },
                //病人管理首页
                {
                    path: '/patientindex',
                    component: resolve => require(['../components/patient/index.vue'], resolve),
                    meta: {
            			requireAuth: true,  // 添加该字段，表示进入这个路由是需要登录的
      				}
                },
                //病人登记
               {
                    path: '/patientadd',
                    component: resolve => require(['../components/patient/add.vue'], resolve),
                    meta: {
            			requireAuth: true,  // 添加该字段，表示进入这个路由是需要登录的
      				}
                },
                //病患类型添加
               {
                    path: '/patienttypeadd',
                    component: resolve => require(['../components/patienttype/add.vue'], resolve),
                    meta: {
            			requireAuth: true,  // 添加该字段，表示进入这个路由是需要登录的
      				}
                },
                //科室列表
               {
                    path: '/deportmentindex',
                    component: resolve => require(['../components/deportment/index.vue'], resolve),
                    meta: {
            			requireAuth: true,  // 添加该字段，表示进入这个路由是需要登录的
      				}
                },
                //科室添加
               {
                    path: '/deportmentadd',
                    component: resolve => require(['../components/deportment/add.vue'], resolve),
                    meta: {
            			requireAuth: true,  // 添加该字段，表示进入这个路由是需要登录的
      				}
                }
            ]
        },
        {
            path: '/login',
            name:'login',
            component: resolve => require(['../components/base/Login.vue'], resolve)
        },
        {
            path: '/register',
            component: resolve => require(['../components/base/register.vue'], resolve)
        }
    ]
})
